package com.example.dishfo.myapplication.activity.forget;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.example.dishfo.myapplication.R;
import com.example.dishfo.myapplication.activity.BaseActivity;
import com.example.dishfo.myapplication.customview.toolbar.TextTitle;
import com.example.dishfo.myapplication.util.ActivityUtil;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ForgetActivity extends BaseActivity {

    @BindView(R.id.webview_activityforget) WebView webView;
    @BindView(R.id.textTitle_activityforget) TextTitle textTitle;
    private String baseURL="http://www.baidu.com/";

    private View.OnClickListener listenerBack=v -> {
      onBackPressed();
    };

    @SuppressLint("SetJavaScriptEnabled")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityUtil.setTransportStatusBar(getWindow());
        setContentView(R.layout.activity_forget);
        setSupportActionBar(findViewById(R.id.toolbar));
        ButterKnife.bind(this);

        WebSettings settings=webView.getSettings();
        webView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideKeyEvent(WebView view, KeyEvent event) {
                return false;
            }
        });

        settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
        settings.setJavaScriptEnabled(true);
        settings.setDomStorageEnabled(true);
        webView.loadUrl(baseURL);

        textTitle.setOnClickListener(listenerBack);
    }
}
